package company.alibaba;

import java.math.BigInteger;
import java.util.Scanner;

public class Aili3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextInt();
        BigInteger result = new BigInteger(String.valueOf(0));
        BigInteger tmp = new BigInteger(String.valueOf(1));

        for (long i = n; i >0; i--) {
            tmp = tmp.multiply(BigInteger.valueOf(i));
            result = result.add(tmp);
        }

        System.out.println(result);
    }
}
